package test;


import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;

import javafx.scene.paint.Color;
import javafx.scene.shape.*;
import javafx.stage.Stage;


public class Main extends Application {
    @Override
    public void start(Stage primaryStage) throws InterruptedException {
        Pane pane = new Pane();  // 创建一个面板

        Rectangle r = new Rectangle();
        r.setX(50);
        r.setY(50);
        r.setWidth(60);
        r.setHeight(10);
        r.setStroke(Color.BLACK);
        r.setFill(Color.rgb(139,105,20));

        Circle circle = new Circle();
        circle.setCenterX(65);
        circle.setCenterY(65);
        circle.setRadius(5);
        circle.setStroke(Color.BLACK);
        circle.setFill(Color.GREEN);

        Circle circle2 = new Circle();
        circle2.setCenterX(95);
        circle2.setCenterY(65);
        circle2.setRadius(5);
        circle2.setStroke(Color.BLACK);
        circle2.setFill(Color.GREEN);
        pane.getChildren().add(circle);
        pane.getChildren().add(circle2);
        pane.getChildren().add(r);

        // 创建路径转变，其实坐标为(50, 150)，终点坐标为(450, 150)
        //PathTransition pathTransition=new PathTransition(Duration.seconds(2), new Line(50, 150, 450, 150), circle);
        //pathTransition.setCycleCount(Animation.INDEFINITE);
        //pathTransition.play();

        // 将面板加入屏幕，并设置屏幕尺寸和标题
        Scene screen = new Scene(pane, 500, 300);
        primaryStage.setTitle("byack");
        primaryStage.setScene(screen);
        primaryStage.show();
    }
}

